//定义Point类和Line类（Line类的成员是Point的对象——复合），
//分别完成构造函数、析构函数、赋值运算符函数、
//拷贝构造函数及其它需要的方法。
//在主程序构造两条Line，并判断哪条线更长。
//run.cpp
#include <iostream>
#include <ctime>
#include "Line.hpp"
#include "Point.hpp"
using namespace std;

int main() {
    srand((int)time(0));
    for (int i = 0; i < 10000; i++) {
        cout << "第" << i << "次测试" << endl;
        double x1 = rand() % 100000;
        double y1 = rand() % 100000;
        double x2 = rand() % 100000;
        double y2 = rand() % 100000;
        double x3 = rand() % 100000;
        double y3 = rand() % 100000;
        double x4 = rand() % 100000;
        double y4 = rand() % 100000;
        Line line1(x1, y1, x2, y2);
        Line line2(x3, y3, x4, y4);
        cout << "line1上的点为：";
        line1.displayPoint1();
        cout << ", ";
        line1.displayPoint2();
        cout << endl;
        cout << "line2上的点为：";
        line2.displayPoint1();
        cout << ", ";
        line2.displayPoint2();
        cout << endl;
        cout << "line1的长度为：" << line1.length() << endl;
        cout << "line2的长度为：" << line2.length() << endl;
        cout << (line1.length() > line2.length() ? "line1" : "line2")  
                << "更长" << endl;
        cout << "----------------------" << endl;
    }

    return 0;
}